package com.geek2.springbootdemo.controller;

import com.fasterxml.jackson.databind.util.JSONPObject;
import com.geek2.springbootdemo.mapper.UserMapper;
import com.geek2.springbootdemo.pojo.SmbmsUser;
import com.geek2.springbootdemo.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RestControllerDemo {
    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/rest")
    public String Demo() {
        return "hello RestController";
    }

    @RequestMapping("/userlist")
    public JsonUtil userlist() {
        System.out.println("======userlist======");
        List<SmbmsUser> smbmsUsers = userMapper.queryAllUser(null);
        return new JsonUtil(smbmsUsers, "0", "", "3000");
    }

}
